import BaseView from "../../components/BaseView"
import cjs=createjs
//import createjs from "../../../createjs"
export default class BaseDialogView extends BaseView{
    private bg=new cjs.Shape()
    protected content=new cjs.Container()
    constructor(){
        super()
        this.addChild(this.bg)
        this.content.setTransform(this.width/2,this.height/2,0,0)
        this.addChild(this.content)
    }
    zoomIn():void{
        cjs.Tween.get(this.content).to({scaleX:1,scaleY:1},0.5,cjs.Ease.quartIn)
    }
    zoomOut():Promise<void>{
        return new Promise<void>((resolve,reject)=>{
            //console.log(this.content)
            try{
                cjs.Tween.get(this.content).to({scaleX:0,scaleY:0},0.6,cjs.Ease.quartOut).call(resolve)
            }catch(e:any){reject()}
        })
    }
    reflush(): void {
        const g=this.bg.graphics
        g.clear()
        g.beginFill('rgba(0,0,0,0.5)')
        g.drawRect(0,0,this.width,this.height)
        g.endFill()
    }
    //
}